#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDebug>
#include <QMessageBox>
#include <QModbusRtuSerialMaster>
#include "serialPortList.h"


QT_BEGIN_NAMESPACE

namespace Ui { class Widget; }
class QModbusClient;
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();


private slots:
    void on_connectButton_clicked();
    void onNewPortList(QStringList portName);
    void onTimeout();

private:
    Ui::Widget *ui;

    QModbusClient  *modbusDevice = nullptr;
    SerialPortList *portList     = nullptr;
    QStringList portlist;
    int portState = -1;
};
#endif // WIDGET_H
